// pages/mine/store_admin/refund.js
Page({

  data: {  code:'',type:'1',list:{}

  },

  onLoad: function (options) {
     this.setData({code:options.code})
     this.gettuikuan()
  },
  //获取退款数据
   gettuikuan(){
     wx.request({
       url: 'https://zujieba.com/Api/storeadminorder/refund.html',
       data:{code:this.data.code},
       method:'POST',
       success:(res)=>{
         console.log(res);
         let list=res.data.data
         this.setData({list})
       }

     })
   },
   toggle(e){
     this.setData({
       type:e.currentTarget.dataset.type
     })
   },
   //提交
   suretijiao(){
      wx.request({
        url: 'https://zujieba.com/Api/storeadminorder/tuikuan.html',
        data:{code:this.data.code,type:this.data.type},
        method:'POST',
        success:(res)=>{
          console.log(res);
          if(res.data.success==1){
            wx.navigateBack({
              complete: (res) => {},
            })
            wx.showToast({
              title: res.data.tips,
              duration:2000,
              icon:'success'
            })
          }
          
        }
      })
   }
  
})